<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/view/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
	
	<title>Insert title here</title>
 <link href="${project}/ds/css/input.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/layui/css/layui.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet"/>
    <link href="${project}/ds/lib/layui/css/layui.css" rel="stylesheet"/>

    <script src="${project}/ds/lib/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/ligerUI/js/core/inject.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

    <script src="${project}/ds/lib/jquery.form.js" type="text/javascript"></script>
    <script src="${project}/ds/lib/layui/layui.js" type="text/javascript"></script>
    <script src="${project}/ds/js/js/ws.js" type="text/javascript"></script>
    <script src="${project}/ds/js/XHD.js" type="text/javascript"></script>
    <script src="${project}/ds/js/room/command.js" type="text/javascript"></script>
    <script type="text/javascript">
        var manager;
        var total;
        var CONTEXT_PATH = "http://" + document.location.host;
        var user = getCookie("xhdcrm_uid");
        var layer;
        var loadindex;
        var pag = "roomsetting";
        layui.use(['layer'],
            function () {
                layer = layui.layer;
            });
        $(function () {
            $("#tree1").ligerTree({
                url: '/loudong/getTree',
                onSelect: onSelect,
                idFieldName: 'text',
                nodeWidth: 150,
                checkbox: false,
                itemopen: false
            });
            manager = $("#maingrid4")
                .ligerGrid({
                    //列排序影响到结尾报表，不要轻易移动位置
                    columns: [
                        { display: '楼栋', name: 'D_BanName', width: 80 },
                        { display: '单元', name: 'D_Unit', width: 80 },
                        { display: '位置', name: 'D_position', width: 80 },
                        { display: '房间号', name: 'D_RoomNo', width: 80 },
                        { display: '原单价', name: 'D_Price', width: 110 },
                        { display: '原总价', name: 'D_Total', width: 110 },
                        { display: '优惠单价', name: 'D_discountPrice', width: 110 },
                        { display: '优惠总价', name: 'D_discountTotal', width: 110 },
                        { display: '建筑面积', name: 'D_FloorArea', width: 80 },
                        { display: '订单号', name: 'D_SerialNumber', width: 80 },
                        { display: '购房人', name: 'Name', width: 80 },
                        { display: '身份证', name: 'CardNo', width: 160 },
                        { display: '手机', name: 'Tel', width: 110 },
                        { display: '置业顾问', name: 'D_Saller', width: 80 },
                        { display: '代理机构', name: 'D_Proxy', width: 80 },
                        {
                            display: '状态',
                            name: 'D_state',
                            width: 80,
                            render: function (item) {
                                if (item.D_state === "-1" || item.D_state === -1) {
                                    return "";}
                                if (parseInt(item.D_state) === 2 ||parseInt(item.D_Monitor)===3)
                                { return '已售'; }
                                return '未售';
                            }
                        },
                        {
                            display: '购买信息',
                            name: 'D_OperationRemark',
                            width: 660
                        }
                    ],
                    rownumbers: true,
                    dataAction: 'server',
                    sortName: "optdate",
                    sortOrder: "desc",
                    pageSize: 50,
                    rowHeight: 22,
                    usePager: false,
                    pageSizeOptions: [20, 30, 50, 100],
                    width: '100%',
                    height: '100%',
                    heightDiff: 31,//不显示页面栏
                    url: "/report/getGrid",
                    onRClickToSelect: true,
                    alternatingRow: false
                });
        });

        function onSelect(note) {
            var data = note.data;
            console.log(data);
            console.log(data.D_ID);
            if (data.children) {
                //父节点
                manager.set("url", "/report/getGrid");
            } else {
                var ban = note.data.text;
                manager.set("url", "/report/getGridByLd?id=" + data.D_ID);
            }
        }


        function ShowRoomGrid(data) {

            if (loadindex) {
                layer.close(loadindex);
            }
            var row = { Rows: data };
            manager.set({data:row});
            var width = window.innerWidth;
            $("#right").css("width", width - $("#maingrid4").width());
        }

        function GetExcel() {
        	 window.location="/report/GetExcel";
        }

        function ShowOnline() {
            layer.open({
                type: 2,
                title: '销售简报',
                shadeClose: true,
                area: ['980px', '550px'],
                content: '../Car/Online.html'
            });
        }
    </script>
</head>
<body>

<form id="form1" onsubmit="return false">
    <input type="hidden" name="username" id="username"/>
    <input type="hidden" name="name" id="name"/>
    <input type="hidden" name="cardno" id="cardno"/>
    <input type="hidden" name="tel" id="tel"/>
    <div style="margin: 2px 10px;">
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-btn layui-btn-normal" onclick="GetExcel()">报表导出</div>
            </div>
            <div class="layui-inline">
                <div class="layui-btn layui-btn-normal" onclick="ShowOnline()">销售简报</div>
            </div>
        </div>
        </div>
    <div style="right: 0; bottom: 0; left: 0; position: fixed; top: 42px; border-top:1px solid #ccc;">
        <div id="layout1" style="height: 100%;width: 100%;">
            <div title="楼盘架构" style="float: left; width: 10%;height: 100%;">
                <div id="treeDiv" style="width: 230px; height: 100%; float: left; border: 0px solid #ccc; overflow: auto;">
                    <ul id="tree1"></ul>
                </div>
            </div>
            <div style="float: right; width: 90%; height:100%;">
                    <div id="maingrid4" style="overflow-y: auto; height:100%;"></div>
            </div>
        </div>
    </div>
</form>
</body>
</html>